<html>
	<head>
		<title>Lab 3 v1</title>
		<style type="text/css">
			.blue { color: blue; }
		</style>
		<script tyoe="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
		<script type="text/javascript">
		$(function()
		{
			$("body").on("keyup", onKeyPress);
			$("#key").addClass("blue");
		});

		function onKeyPress(e)
		{
			// As e.key is in English, let's have a mapping table for their Norwegian name
			var keyCodes =
			{
				37 : "venstre",
				38 : "opp",
				39 : "høyre",
				40 : "ned"
			};

			var pressedMessage = "Du trykket ";
			var pressedKey = keyCodes[e.keyCode];
			if (typeof(pressedKey) == "undefined")
				return; // We don't care about other keys than the arrow keys

			pressedMessage += keyCodes[e.keyCode];

			$("#key").html(pressedMessage);
			console.log(pressedMessage);
	}
	</script>
</head>
	<body>
		<p id="key"></p>
	</body>
</html>
